V2EX  ›  英汉词典

Stack Unwinding

释义 Definition

栈展开:在程序发生异常(或函数提前退出)时,运行时系统按调用栈的逆序“退栈”,依次销毁局部对象、执行清理代码(如 C++ 析构函数、finally 块),并把控制权传递到匹配的异常处理位置。

发音 Pronunciation (IPA)

/stæk ʌnˈwaɪndɪŋ/

例句 Examples

Stack unwinding frees local resources when an exception is thrown.
当抛出异常时,栈展开会释放局部资源。

During stack unwinding, each destructor runs in reverse order of construction, ensuring the file handle is closed even if the function fails.
在栈展开过程中,每个析构函数会按构造的相反顺序执行,从而即使函数失败也能确保文件句柄被关闭。

词源 Etymology

stack 原指“堆/叠起来的一摞”,在计算机里引申为“调用栈”(像盘子一样后进先出叠放);unwinding 来自 unwind(“解开、松开缠绕”)。合在一起比喻:当异常发生时,把“卷起来”的函数调用一层层“解开”,回退到更外层的调用点,并完成必要的清理。

相关词 Related Words

文学与经典作品 Literary Works

  • The C++ Programming Language(Bjarne Stroustrup)——讨论异常处理与对象析构时的栈展开机制。
  • *Effective C++*(Scott Meyers)——在异常安全与资源管理(如 RAII)语境中提及栈展开。
  • Computer Systems: A Programmer’s Perspective(Bryant & O’Hallaron)——在过程调用与栈/控制流相关内容中涉及“unwinding”与调用栈概念。
  • The Linux Programming Interface(Michael Kerrisk)——在错误处理、信号与程序控制流的讨论中关联调用栈与回退/展开概念。
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   724 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 17ms · UTC 21:26 · PVG 05:26 · LAX 13:26 · JFK 16:26
♥ Do have faith in what you're doing.